Add PR preview screenshot workflow - #65
Conversation
- Add .github/workflows/pr-preview.yml: triggers on PRs to main, runs a dedicated Unity play-mode test, uploads the PNG as a GitHub Actions artifact (14-day retention), and posts a PR comment with a direct download link via actions/github-script - Add Assets/Tests/PlayMode/SceneScreenshotTests.cs: loads the bundled ProofOfConcept scene, bypasses the startup menu by advancing the GameManager state, waits up to 4 minutes for the map build pipeline to reach GameState.Racing, then captures a 1920x1080 PNG using Camera.Render() + RenderTexture (works in headless/batch mode) - Add Assets/Tests/PlayMode/SceneScreenshotTests.cs.meta: Unity metadata Co-authored-by: adam133 <20442729+adam133@users.noreply.github.com> Agent-Logs-Url: https://github.com/adam133/vectorroad/sessions/15e71ff2-beeb-4983-9c4b-dca9a8b4341a
📸 PR Preview ScreenshotA screenshot of the default location in play mode was captured for this PR.
|
|
@copilot got an error in the workflow: ✅ playmode-results.xml - 38/38 - Passed in 9.993sAnalyze result: Also, the screenshot is just terrain - make sure it's taken after the car has been set to a road. |
… screenshot - Add `issues: write` permission to pr-preview.yml so that actions/github-script can post PR comments via the Issues API (github.rest.issues.createComment requires this permission) - Add `yield return new WaitForSeconds(3f)` after GameState.Racing so that physics has time to settle the vehicle onto the road surface and ChaseCam's SmoothDamp has time to move from its initial position to behind the vehicle before the screenshot is captured Co-authored-by: adam133 <20442729+adam133@users.noreply.github.com> Agent-Logs-Url: https://github.com/adam133/vectorroad/sessions/5bceafe7-9ab6-4c42-977f-a4d9b35085dc
Fixed in c9f3cc1:
|
📸 PR Preview ScreenshotA screenshot of the default location in play mode was captured for this PR.
|
Each PR now automatically captures a 1920×1080 screenshot of the default map location in Unity play mode and posts a direct artifact download link as a PR comment.
Workflow (
.github/workflows/pr-preview.yml)mainSceneScreenshotTestsviagame-ci/unity-test-runner@v4(play mode, filtered by class name)Screenshots/pr-preview.pngas a 14-day artifactartifact-urloutput as the download link; falls back to a run link if capture failedPlay-mode test (
Assets/Tests/PlayMode/SceneScreenshotTests.cs)ProofOfConceptscene (bundled Ames, Iowa data)GameManagertoLoadingMapimmediately after scene load —MapSceneBuilder.WaitForMenuThenBuildunblocks on the state changeGameState.Racing(level fully built) with an explicit null-guard onGameManager.InstanceCamera.Render()→RenderTexture→Texture2D.ReadPixels()→ PNG — works in headless batch mode without a display<project root>/Screenshots/pr-preview.pngwhere the workflow artifact step picks it up[Timeout(300000)]guards the full 5-minute budgetOriginal prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.